[#include "/WEB-INF/pages/common/taglibs.ftl"]
[@c.url var="backUrl" value="/manage/Feedback_list.action" scope="page"][/@c.url]
[#assign renderTo="#feedbackTableList"]
[#macro _script]
	<script type="text/javascript" src="[@c.url value='/js/plugins/jquery.alerts.js'/]"></script>
	<script type="text/javascript">
		var base = (function(){
			// 事件绑定
			function _addEventListeners() {
				// 维护
				$('a[act=edit]').unbind('click').click(function(){
					var id = $(this).parent().attr('tval');
					[@c.url var="editUrl" value='/manage/Feedback_edit.action' scope="page"]
					[/@c.url]
					var _form = $('<form action="${editUrl}" method="get"><input type="hidden" name="id" value="'+ id +'"/></form>').prependTo(document.body);
					_form.submit();
					//var url = "${editUrl}&id=" + id;
					//$.get(url, {'id':id, 'ajax':'true'}, function(data) {
					//	$('#body').html(data);
					//})
					//window.location = url;
				})
				
				// 删除
				$('a[act=delete]').unbind('click').click(function(){
					var id = $(this).parent().attr('tval');
					var title = $('#delete-confirm').attr('title');
					var content = $('#delete-confirm').html();
					jConfirm(content, title, function(r) {
						if (r) {
							[@c.url	var="deleteUrl" value='/manage/Feedback_delete.action' scope="page"]
								[@c.param name="backUrl" value="${backUrl}"/]
							[/@c.url]
							
							var _form = $('<form action="${deleteUrl}" method="get"><input type="hidden" name="id" value="'+ id +'"/></form>').prependTo(document.body);
							_form.submit();
							//window.location	= "${deleteUrl}" + id;
						}
					});
					return false;
				})
			};
			return {
                config: {
                	url : null,
                    theme: null
                },
                init: function () {
                    _addEventListeners();
                }
			}
		}());
		
		$(function(){
			var link = "[@c.url value='/manage/Feedback_list.action?currentPage=${currentPage}' /]";
			base.config.theme = getTheme();
			base.config.url = link;
            //Initializing the form
			base.init();
		})
	</script>
[/#macro]

[#macro _content]
	<form action="[@c.url value='/manage/Feedback_update.action?backurl=${action.backurl}'/]" method="post">
		<input type="hidden" name="id" value="${(feedback.id)!''}"/>
		<input type="hidden" name="feedback.id" value="${(feedback.id)!''}"/>
		<table cellspacing="0" cellpadding="0" border="0" class="stdtable-form">
			<thead>
				<tr>
					<th class="head0"></th>
					<th class="head1"></th>
					<th class="head0"></th>
					<th class="head1"></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>标题：[#--[@fmt.message key="manage.category"/] --]</td>
					<td colspan=3>
						<input class="smallinput" placeholder="标题" name="feedback.title" value="${(feedback.title)!''}"/>
					</td>
				</tr>
				<tr>
					<td>内容：</td>
					<td colspan=3>
						<textarea class="longinput" rows=6 placeholder="内容" name="feedback.content">${(feedback.content)!''}</textarea>
					</td>
				</tr>
				<tr>
					<td>网友：</td>
					<td colspan=3>
						<input class="tinyinput" placeholder="发送者" name="feedback.sendName" value="${(feedback.sendName)!''}"/>
            	&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" style="text-align:right;line-height:24px;"> 用户详细</a>
					</td>
				</tr>
				<tr>
					<td>所在地：</td>
					<td>
						<input class="longinput" placeholder="所在地" name="feedback.sendRegion" value="${(feedback.sendRegion)!''}"/>
					</td>
					<td>IP地址：</td>
					<td><input class="tinyinput" readonly="readonly" placeholder="ip地址" name="feedback.ipAddress" value="${(feedback.ipAddress)!''}"/></td>
				</tr>
				<tr>
					<td>审核阶段:</td>
					<td><input class="longinput" placeholder="审核阶段" name="feedback.type" value="${(feedback.type)!''}"/></td>
					<td>时间：</td>
					<td><input class="tinyinput" readonly="readonly" placeholder="时间" name="feedback.createDate" value="[#if feedback != null && (feedback.createDate)??]${(feedback.createDate)?datetime?string.medium}[/#if]"/></td>
				</tr>
				<tr>
					<td colspan="4">
						<button class="submit ">提&nbsp;&nbsp;交</button>
						<input type="reset" class="reset radius2" value="重&nbsp;&nbsp;置">
						<a style="margin-left: 6px; background-color: rgb(247, 247, 247); border-color: rgb(204, 204, 204); color: rgb(51, 51, 51);" href="${action.backurl}" class="anchorbutton button_alert">
							<span style="line-height: 21px; background-color: rgb(255, 255, 255); border-color: rgb(221, 221, 221);">返&nbsp;&nbsp;回</span>
						</a>
					</td>
				</tr>
			</tbody>
		</table>
		<br>
	</form>
[/#macro]

[#if piece==true]
		[@_script /]
		<!--设置提交行为-->
		[#assign act="save" /]
		<!--设置table渲染到指定ID节点-->
		[@_content /]
[#else]
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Insert title here</title>
		<meta name="menu" content="AdminMenu"/>
		<meta name="heading" content="heading"/>
		[@_script /]
	</head>
	<body id="body">
		<div class="contenttitle radiusbottom0">
			<h2 class="table"><span>留    言</span></h2>
		</div><!--contenttitle-->
		<div id="feedbackTableList">
			[@_content /]
		</div>
	</body>
	</html>
[/#if]